
import { CommonUtils } from "./CommonUtils";

const { ccclass, property } = cc._decorator;

@ccclass
export default class Box extends cc.Component {

    boxData;

    // 初始化
    init(event) {
        this.boxData = event;
        this.node.stopAllActions()
        this.node.opacity = 0;
        const colos = [cc.Color.BLUE, cc.Color.CYAN, cc.Color.GREEN, cc.Color.MAGENTA, cc.Color.ORANGE, cc.Color.RED, cc.Color.WHITE, cc.Color.YELLOW]
        this.node.color = colos[Math.floor((Math.random()) * colos.length)]
        cc.tween(this.node)
            .to(0.3, {opacity:255})
            .start()
    }

    // 干掉自己
    destroySelf(){
        this.node.destroy();
    }
}
